"""
1. 学习目标

2.

"""
import os

import pandas as pd


class DataOperation:
    def __init__(self, path):
        self.data = pd.read_excel(path)

    # 转换列表嵌套字典
    def get_data_to_dict(self):
        # [{},{},{}]
        return [self.data.loc[i].to_dict() for i in self.data.index.values]

    # 转换列表嵌套列表
    def get_data_to_list(self):
        # [[],[],[]]
        return self.data.values.tolist()


if __name__ == '__main__':
    rootpath = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
    target_path = os.path.join(rootpath, 'data', 'lj_data.csv')
    print(target_path)
    do = DataOperation(target_path)
    # print(do.get_data_to_list())
    print(do.get_data_to_dict())
